package com.teatang.tadmin.sysuser.controller;

import com.teatang.tadmin.core.controller.BaseApiController;
import com.teatang.tadmin.core.page.BaseReturn;
import com.teatang.tadmin.core.page.PageDataReturn;
import com.teatang.tadmin.sysuser.pojo.SysUser;
import com.teatang.tadmin.sysuser.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SysUserApiController extends BaseApiController {
    @Autowired
    private SysUserService sysUserService;

    @GetMapping("/sys-user-api/list")
    public PageDataReturn pageList() {
        startPage();
        return sysUserService.getSysUsersPageData();
    }

    @PostMapping("/sys-user-api/add")
    public BaseReturn doAdd (SysUser sysUser) {
        return sysUserService.insertSysUser(sysUser);
    }

    @PostMapping("/sys-user-api/edit")
    public BaseReturn doEdit (SysUser sysUser) {
        return sysUserService.updateSysUser(sysUser);
    }

    @GetMapping("/sys-user-api/delete")
    public BaseReturn delete(String ids) {
        return sysUserService.deleteSysUserByIds(ids);
    }
}
